<!DOCTYPE html>
<html>
    <head>
    <title>canvas drawImage() test</title>
    <style>
    canvas {
        border: 1px solid black;
    }
    </style>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            img = document.querySelector("img");

            img.addEventListener("load", function() {
                var ctx = document.querySelector("canvas").getContext("2d");
                ctx.fillStyle = '#666';
                ctx.fillRect(0, 0, 400, 400);
                ctx.scale(2, 2);
                ctx.drawImage(img, 30, 30);
            });
        });
    </script>
    </head>
    <body>
        <canvas width=400 height=400></canvas>
        <img src="../../../res/graphics/buggie.png">
    </body>
</html>
